/*
 * Copyright (c) 2016. MaxSky.TK. All Rights Reserved.
 */

package tk.maxsky.simplemvc;

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

import tk.maxsky.simplemvc.base.BaseActivity;
import tk.maxsky.simplemvc.implement.MainImplement;
import tk.maxsky.simplemvc.model.MainModel;

public class MainActivity extends BaseActivity implements MainImplement, OnClickListener {

	private Button button;
	private TextView textView;
	private MainModel mainModel;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		mainModel = new MainModel();
		button = (Button) this.findViewById(R.id.btn);
		textView = (TextView) findViewById(R.id.tv_view);
		button.setOnClickListener(this);
	}

	@Override
	public void loadData() {
		mainModel.loadData(textView);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
			case R.id.btn:
				loadData();
				break;
			default:
				break;
		}
	}
}